package com.shop.entity;

// Generated 2015-10-7 22:59:34 by Hibernate Tools 4.0.0

import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * Category generated by hbm2java
 */
@Entity
@Table(name = "category", catalog = "shop")
public class Category implements java.io.Serializable {

	private Integer kindId;
	private Category category;
	private int kindLevel;
	private String kindName;
	private Set<SkuProd> skuProdsForSku2Id2 = new HashSet<SkuProd>(0);
	private Set<Category> categories = new HashSet<Category>(0);
	private Set<SkuProd> skuProdsForSku2Id1 = new HashSet<SkuProd>(0);

	public Category() {
	}
	
	public Category(Category category) {
	this.kindId = category.getKindId();
	this.kindLevel = category.getKindLevel();
	this.kindName = category.getKindName();
}

	public Category(int kindLevel, String kindName) {
		this.kindLevel = kindLevel;
		this.kindName = kindName;
	}

	public Category(Category category, int kindLevel, String kindName,
			Set<SkuProd> skuProdsForSku2Id2, Set<Category> categories,
			Set<SkuProd> skuProdsForSku2Id1) {
		this.category = category;
		this.kindLevel = kindLevel;
		this.kindName = kindName;
		this.skuProdsForSku2Id2 = skuProdsForSku2Id2;
		this.categories = categories;
		this.skuProdsForSku2Id1 = skuProdsForSku2Id1;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "kind_id", unique = true, nullable = false)
	public Integer getKindId() {
		return this.kindId;
	}

	public void setKindId(Integer kindId) {
		this.kindId = kindId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "parent_id")
	public Category getCategory() {
		return this.category;
	}

	public void setCategory(Category category) {
		this.category = category;
	}

	@Column(name = "kind_level", nullable = false)
	public int getKindLevel() {
		return this.kindLevel;
	}

	public void setKindLevel(int kindLevel) {
		this.kindLevel = kindLevel;
	}

	@Column(name = "kind_name", nullable = false, length = 100)
	public String getKindName() {
		return this.kindName;
	}

	public void setKindName(String kindName) {
		this.kindName = kindName;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "categoryBySku2Id2")
	public Set<SkuProd> getSkuProdsForSku2Id2() {
		return this.skuProdsForSku2Id2;
	}

	public void setSkuProdsForSku2Id2(Set<SkuProd> skuProdsForSku2Id2) {
		this.skuProdsForSku2Id2 = skuProdsForSku2Id2;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "category")
	public Set<Category> getCategories() {
		return this.categories;
	}

	public void setCategories(Set<Category> categories) {
		this.categories = categories;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "categoryBySku2Id1")
	public Set<SkuProd> getSkuProdsForSku2Id1() {
		return this.skuProdsForSku2Id1;
	}

	public void setSkuProdsForSku2Id1(Set<SkuProd> skuProdsForSku2Id1) {
		this.skuProdsForSku2Id1 = skuProdsForSku2Id1;
	}

}
